{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "class Country():\n",
    "    def __init__(self, name='Unspecified', population=None, size_kmsq=None):\n",
    "        self.name = name\n",
    "        self.population = population\n",
    "        self.size_kmsq = size_kmsq\n",
    "        \n",
    "    def __str__(self):\n",
    "        return self.name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Chad\n"
     ]
    }
   ],
   "source": [
    "chad = Country(name='Chad')\n",
    "print(chad)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "class Country():\n",
    "    def __init__(self, name='Unspecified', population=None, size_kmsq=None):\n",
    "        self.name = name\n",
    "        self.population = population\n",
    "        self.size_kmsq = size_kmsq\n",
    "        \n",
    "    def __str__(self):\n",
    "        label = self.name\n",
    "        if self.population:\n",
    "            label = '%s, population: %s' % (label, self.population)\n",
    "        if self.size_kmsq:\n",
    "            label = '%s, size_kmsq: %s' % (label, self.size_kmsq)\n",
    "        return label"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Chad, population: 100\n"
     ]
    }
   ],
   "source": [
    "chad = Country(name='Chad', population=100)\n",
    "print(chad)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
